<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <link rel="shortcut icon" href="${pageContext.request.contextPath}img/icons/icon-48x48.png"/>

    <title>新闻列表</title>

    <link href="${pageContext.request.contextPath}/css/app.css" rel="stylesheet">
</head>

<body>
<div class="wrapper">
    <%@include file="../icn/sidebar.jsp" %>
    <div class="main">
        <%@include file="../icn/head.jsp" %>

        <div class="card" style="margin: 42px">
<%--            <div class="card-body">--%>
<%--                <form class="form-inline">--%>
<%--                    <label class="sr-only" for="inlineFormInputName2">Name</label>--%>
<%--                    <input type="text" class="form-control mb-2 mr-sm-2" id="inlineFormInputName2"--%>
<%--                           placeholder="Jane Doe">--%>

<%--                    <label class="sr-only" for="inlineFormInputGroupUsername2">Username</label>--%>
<%--                    <div class="input-group mb-2 mr-sm-2">--%>
<%--                        <input type="text" class="form-control" id="inlineFormInputGroupUsername2"--%>
<%--                               placeholder="Username">--%>
<%--                    </div>--%>

<%--                    <div class="custom-control custom-checkbox mb-1 mr-sm-2">--%>
<%--                        <input type="checkbox" class="custom-control-input" id="customControlInline">--%>
<%--                    </div>--%>

<%--                    <button type="submit" class="btn btn-primary mb-2">搜索</button>--%>
<%--                </form>--%>
<%--            </div>--%>
            <div class="row">
                <div class="col-12">
                    <div class="card flex-fill">
                        <div class="card-header">

                            <h5 class="card-title mb-0">新闻管理</h5>
                        </div>
                        <table class="table table-hover my-0">
                            <tr>
                                <th>标题</th>
                                <th class="d-none d-xl-table-cell">作者</th>
                                <th class="d-none d-xl-table-cell">内容</th>
                                <th>发布时间</th>
                                <th>修改时间</th>
                                <th class="d-none d-md-table-cell">操作</th>

                            </tr>
                            <c:forEach items="${newListPage.list}" var="n">
                                <tr>
                                    <td><span style="display: inline-block; width: 400px;white-space: nowrap; overflow: hidden; text-overflow: ellipsis">${n.title}</span></td>
                                    <td class="d-none d-xl-table-cell">${n.userInfo.name}</td>
                                    <td class="d-none d-xl-table-cell"><a style="text-decoration: none; color: rgb(73,80,87)" href="${pageContext.request.contextPath}/system/news/newsContent/${n.id}">详情</a></td>
                                    <td class="d-none d-xl-table-cell"><fmt:formatDate value="${n.createTime}"
                                                                                       pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                    <td class="d-none d-xl-table-cell"><fmt:formatDate value="${n.updateTime}"
                                                                                       pattern="yyyy-MM-dd HH:mm:ss"/></td>
                                    <td class="table-action">
                                        <a href="${pageContext.request.contextPath}/system/news/newsEdit1/${n.id}">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                                 viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
                                                 stroke-linecap="round" stroke-linejoin="round"
                                                 class="feather feather-edit-2 align-middle">
                                                <path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
                                            </svg>
                                        </a>
                                        <a href="${pageContext.request.contextPath}/system/news/deleteNew/${n.id}">
                                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                                                 viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
                                                 stroke-linecap="round" stroke-linejoin="round"
                                                 class="feather feather-trash align-middle">
                                                <polyline points="3 6 5 6 21 6"></polyline>
                                                <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
                                            </svg>
                                        </a>
                                    </td>
                                </tr>
                            </c:forEach>
                        </table>
                    </div>
                    <ul class="pagination pg-primary">
                        <c:if test="${newListPage.page!=1}">
                            <li class="page-item">
                                <a class="page-link" href="?page=${newListPage.page-1}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                    <span class="sr-only">Previous</span>
                                </a>
                            </li>
                        </c:if>

                        <c:forEach begin="1" end="${newListPage.pageSize}" var="i">
                            <li class="page-item ${newListPage.page==i?'active':''}">
                                <a class="page-link" href="?page=${i}">${i}</a></li>
                        </c:forEach>

                        <c:if test="${newListPage.page!=newListPage.pageSize}">
                            <li class="page-item">
                                <a class="page-link" href="?page=${newListPage.page+1}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                    <span class="sr-only">Next</span>
                                </a>
                            </li>
                        </c:if>
                        <span style="position: relative;top: 10px;left: 39px;">
                                        共：${newListPage.count}条
                                    </span>

                    </ul>
                </div>
            </div>
        </div>

    </div>
</div>

<script src="${pageContext.request.contextPath}/js/vendor.js"></script>
<script src="${pageContext.request.contextPath}/js/app.js"></script>

</body>

</html>